﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>App Bar Button</title>
</head>
<body><h2>AppBar Button</h2>
<p>AppBarButton control is a button that displays a popup menu when tap on it. You can place this button in app bar and apply any style to manage its presentation. Popup menu can be defined in the XAML file. Menu item invoke is notified through MenuItemInvoked event. If you are using <strong>MVVM</strong> pattern, you can bind your command to MenuCommand property.</p>
<p><img style="vertical-align: middle; height: 262px; margin-top: 1px;" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=storeapplib&amp;DownloadId=547801" alt="AppBar Button with Menu" width="175" /></p>
<h3>Namespace</h3>
<p><code>StoreAppLib.Controls</code></p>
<h3>Using AppBar Button</h3>
<p>To use AppBarButton in your project, add reference to the StoreAppLib project&nbsp; or install StoreAppLib from Visual Studio "Manage NuGet Packages" tool.</p>
<p>To add the control in a page, add the following namespace reference to the page.</p>
<p><code><span style="color: blue; font-size: 9.5pt;" lang="EN">&lt;</span><span style="color: #a31515; font-size: 9.5pt;" lang="EN">Page</span><span style="color: black; font-size: 9.5pt;" lang="EN"> </span><span style="color: red; font-size: 9.5pt;" lang="EN">xmlns</span><span style="color: blue; font-size: 9.5pt;" lang="EN">:</span><span style="color: red; font-size: 9.5pt;" lang="EN">storeApp</span><span style="color: red; font-size: 9.5pt;">Control</span><span style="color: blue; font-size: 9.5pt;" lang="EN">="using:StoreAppLib.Controls"</span><span style="color: blue; font-size: 9.5pt;"> ...</span></code></p>
<p>Menu item is created using MenuItem and separator is created using MenuSeparator. Menu item has two properties – Label and Id. You can customize the menu at Menu level or individual Menu item level.&nbsp; The following code shows a sample AppBar button with a popup menu. </p>
<p><code><span style="font-size: 9.5pt; background: white; color: blue;">&lt;</span><span style="font-size: 9.5pt; background: white; color: #a31515;">Page.BottomAppBar</span><span style="font-size: 9.5pt; background: white; color: blue;">&gt;</span><span style="font-size: 9.5pt; color: black; background: white;"><br />&nbsp;&nbsp; </span><span style="font-size: 9.5pt; background: white; color: blue;">&lt;</span><span style="font-size: 9.5pt; background: white; color: #a31515;">AppBar</span><span style="font-size: 9.5pt; background: white; color: black;"> </span><span style="font-size: 9.5pt; background: white; color: red;"><span>&nbsp;</span>IsSticky </span><span style="font-size: 9.5pt; background: white; color: blue;">= "False"&gt;</span><span style="font-size: 9.5pt; color: black; background: white;"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: 9.5pt; background: white; color: blue;">&lt;</span><span style="font-size: 9.5pt; background: white; color: #a31515;">StackPanel</span><span style="font-size: 9.5pt; background: white; color: red;"> HorizontalAlignment </span><span style="font-size: 9.5pt; background: white; color: blue;">= "Right"&gt;<br /><br /><span style="font-size: 9.5pt; color: #0000ff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</span><span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span><span style="font-size: 9.5pt; color: #0000ff;">:</span><span style="font-size: 9.5pt; color: #a31515;">AppBarButton</span><span style="font-size: 9.5pt; color: #ff0000;"> Caption </span><span style="font-size: 9.5pt; color: #0000ff;">= "Custom Menu"</span><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: 9.5pt; color: #ff0000;">Style</span><span style="font-size: 9.5pt; color: #0000ff;"> = "{</span><span style="font-size: 9.5pt; color: #a31515;">StaticResource</span><span style="font-size: 9.5pt; color: #ff0000;"> SortAppBarButtonStyle</span><span style="font-size: 9.5pt; color: #0000ff;">}"</span><span style="font-size: 9.5pt;">&nbsp;<br /></span><span style="font-size: 9.5pt; color: #ff0000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MenuItemInvoked</span><span style="font-size: 9.5pt; color: #0000ff;"> = "OnAppBarMenuItemInvoked"&gt;&nbsp;<br /><br /><span style="font-size: 9.5pt;"><span style="font-size: x-small; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span>:<span style="font-size: 9.5pt; color: #a31515;">AppBarButton.Menu</span>&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span>:<span style="font-size: 9.5pt; color: #a31515;">Menu</span> <span style="font-size: 9.5pt; color: #ff0000;"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PointerOverBackground </span></span>
    <span style="font-family: Consolas;">= "#FFAF4343" </span><span style="font-size: x-small; font-family: Consolas;"> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: 9.5pt; color: #ff0000;">PressedBackground </span></span><span style="font-family: Consolas;">= "#FFA90000"&nbsp;</span><span style="font-size: x-small; font-family: Consolas;"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size: 9.5pt; color: #ff0000;">Background </span></span><span style="font-family: Consolas;">= "#FFAA3838" </span><span style="font-size: x-small; font-family: Consolas;"> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: 9.5pt; color: #ff0000;">BorderThickness </span></span>
    <span style="font-family: Consolas;">= "4" </span><span style="font-size: x-small; font-family: Consolas;"> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: 9.5pt; color: #ff0000;">BorderBrush</span></span><span style="font-family: Consolas;"> = "#FFFF4141"</span><span style="font-size: x-small; font-family: Consolas;"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: 9.5pt; color: #ff0000;">Foreground</span></span><span style="font-family: Consolas;"> = "White"</span><span style="font-size: x-small; font-family: Consolas;"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-size: 9.5pt; color: #ff0000;">SeparatorThickness</span></span><span style="font-family: Consolas;"> = "3"</span><span style="font-size: x-small; font-family: Consolas;"><br /><span style="font-size: 9.5pt; color: #ff0000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SeparatorColor</span></span><span style="font-family: Consolas;"> = "#FFFF4141"&gt;</span><span style="font-size: x-small; font-family: Consolas;"><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span>:<span style="font-size: 9.5pt; color: #a31515;">Menu.Items</span>&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;<span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span>:<span style="font-size: 9.5pt; color: #a31515;">MenuItem </span><span style="font-size: 9.5pt; color: #ff0000;">Label </span></span></span></span></span><span style="font-size: 9.5pt;"><span style="font-size: 9.5pt; color: #0000ff;">= "Date Picker"/&gt;<br /><span style="font-size: 9.5pt; background: white; color: blue;"><span style="font-size: x-small; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span>&lt;</span><span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span><span style="font-size: 9.5pt; color: #0000ff;">:</span><span style="font-size: 9.5pt; color: #a31515;">MenuItem</span> <span style="font-size: 9.5pt; color: #ff0000;">Label</span><span style="font-size: 9.5pt; color: #0000ff;"> = "Page Header"/&gt;<br /><span style="font-size: 9.5pt; background: white; color: blue;"><span style="font-size: x-small; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span>&lt;</span><span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span><span style="font-size: 9.5pt; color: #0000ff;">:</span><span style="font-size: 9.5pt; color: #a31515;">MenuItem</span> <span style="font-size: 9.5pt; color: #ff0000;">Label </span><span style="font-size: 9.5pt; color: #0000ff;">= "App Bar Button"/&gt;<br /><span style="font-size: 9.5pt; background: white; color: blue;"><span style="font-size: x-small; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span>&lt;</span><span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span><span style="font-size: 9.5pt; color: #0000ff;">:</span><span style="font-size: 9.5pt; color: #a31515;">MenuSeparator</span><span style="font-size: 9.5pt; color: #0000ff;"> /&gt;<br /><span style="font-size: 9.5pt; background: white; color: blue;"><span style="font-size: x-small; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span>&lt;</span><span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span><span style="font-size: 9.5pt; color: #0000ff;">:</span><span style="font-size: 9.5pt; color: #a31515;">MenuItem</span> <span style="font-size: 9.5pt; color: #ff0000;">Label</span><span style="font-size: 9.5pt; color: #0000ff;"> = "Tap Effect"/&gt;<br /><span style="font-size: 9.5pt; background: white; color: blue;"><span style="font-size: x-small; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span>&lt;</span><span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span><span style="font-size: 9.5pt; color: #0000ff;">:</span><span style="font-size: 9.5pt; color: #a31515;">MenuSeparator</span><span style="font-size: 9.5pt; color: #0000ff;"> /&gt;<br /><span style="font-size: 9.5pt; background: white; color: blue;"><span style="font-size: x-small; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span>&lt;</span><span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span><span style="font-size: 9.5pt; color: #0000ff;">:</span><span style="font-size: 9.5pt; color: #a31515;">MenuItem</span> <span style="font-size: 9.5pt; color: #ff0000;">Label</span><span style="font-size: 9.5pt; color: #0000ff;"> ="Date time converter" /&gt;<br /><span style="font-size: 9.5pt; background: white; color: blue;"><span style="font-size: x-small; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span>&lt;</span><span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span><span style="font-size: 9.5pt; color: #0000ff;">:</span><span style="font-size: 9.5pt; color: #a31515;">MenuItem</span> <span style="font-size: 9.5pt; color: #ff0000;">Label</span><span style="font-size: 9.5pt; color: #0000ff;"> ="Count Converter"/&gt;<br /><span style="font-size: 9.5pt; background: white; color: blue;"><span style="font-size: x-small; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span>&lt;</span><span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span><span style="font-size: 9.5pt; color: #0000ff;">:</span><span style="font-size: 9.5pt; color: #a31515;">MenuItem</span> <span style="font-size: 9.5pt; color: #ff0000;">Label</span><span style="font-size: 9.5pt; color: #0000ff;"> ="Concatenation Converter"/&gt;<br /><span style="font-size: 9.5pt; background: white; color: blue;"><span style="font-size: x-small; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span>&lt;/</span><span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span><span style="font-size: 9.5pt; color: #0000ff;">:</span><span style="font-size: 9.5pt; color: #a31515;">Menu.Items</span><span style="font-size: 9.5pt; color: #0000ff;"> &gt;<br /><span style="font-size: 9.5pt; background: white; color: blue;"><span style="font-size: x-small; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>&lt;/</span><span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span><span style="font-size: 9.5pt; color: #0000ff;">:</span><span style="font-size: 9.5pt; color: #a31515;">Menu</span><span style="font-size: 9.5pt; color: #0000ff;"> &gt;<br /><br /><span style="font-size: 9.5pt; background: white; color: blue;"><span style="font-size: x-small; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>&lt;/</span><span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span><span style="font-size: 9.5pt; color: #0000ff;">:</span><span style="font-size: 9.5pt; color: #a31515;">AppBarButton.Menu</span><span style="font-size: 9.5pt; color: #0000ff;"> &gt;<br /><span style="font-size: 9.5pt; background: white; color: blue;"><span style="font-size: x-small; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>&lt;/</span><span style="font-size: 9.5pt; color: #a31515;">storeAppControl</span><span style="font-size: 9.5pt; color: #0000ff;">:</span><span style="font-size: 9.5pt; color: #a31515;">AppBarButton</span><span style="font-size: 9.5pt; color: #0000ff;"> &gt;</span></span><span style="font-size: 9.5pt; background: white; color: blue;"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/<span style="font-size: 9.5pt; background: white; color: #a31515;">StackPanel</span>&gt;<span style="font-size: 9.5pt; color: black; background: white;"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&lt;/<span style="font-size: 9.5pt; background: white; color: #a31515;">AppBar</span>&gt;<span style="font-size: 9.5pt; color: black; line-height: 115%; background: white;"><br />&nbsp;</span><span style="font-size: 9.5pt; background: white; color: blue; line-height: 115%;">&lt;/</span><span style="font-size: 9.5pt; background: white; color: #a31515; line-height: 115%;">Page.BottomAppBar</span><span style="font-size: 9.5pt; background: white; color: blue; line-height: 115%;">&gt;</span></span></code></p>
<p>The event signature is given below.</p>
<p>The &ldquo;source&rdquo; parameter represents the AppBarButton and the "menuItem" represent the menu selected. You can access the Id and Label defined in the XAML using the menuItem object.</p>
<p><code><span style="font-size: 9.5pt; color: black; background: white;">&nbsp;&nbsp; </span><span style="font-size: 9.5pt; background: white; color: blue;">private</span><span style="font-size: 9.5pt; background: white; color: black;"> </span><span style="font-size: 9.5pt; background: white; color: blue;">void</span><span style="font-size: 9.5pt; background: white; color: black;"> OnAppBarMenuItemInvoked(</span><span style="font-size: 9.5pt; background: white; color: black;"><span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; background: white; color: blue;">object</span><span style="font-size: 9.5pt; background: white; color: black;"> source, </span><span style="font-size: 9.5pt; background: white; color: black;"><span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>StoreAppLib.Controls.</span><span style="font-size: 9.5pt; background: white; color: #2b91af;">IMenuItem</span><span style="font-size: 9.5pt; background: white; color: black;"> menuItem)</span><span style="font-size: 9.5pt; background: white; color: black;"><span><br />&nbsp;&nbsp; </span>{<span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; background: white; color: #2b91af;">AppBarButton</span><span style="font-size: 9.5pt; background: white; color: black;"> button = source </span><span style="font-size: 9.5pt; background: white; color: blue;">as</span><span style="font-size: 9.5pt; background: white; color: black;"> </span><span style="font-size: 9.5pt; background: white; color: #2b91af;">AppBarButton</span><span style="font-size: 9.5pt; background: white; color: black;">;</span><span style="font-size: 9.5pt; background: white; color: black;"><span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; background: white; color: blue;">object</span><span style="font-size: 9.5pt; background: white; color: black;"> id = menuItem.Id;</span><span style="font-size: 9.5pt; background: white; color: black;"><span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt; background: white; color: blue;">string</span><span style="font-size: 9.5pt; background: white; color: black;"> label = menuItem.Label;</span><span style="font-size: 9.5pt; background: white; color: black;"><span><br />&nbsp;&nbsp; </span>}</span></code></p>

<p>If you are using MVVM pattern, you can bind your command to &quot;MenuCommand&quot; of the AppBarButton. When the menu is clicked, the command will receive the selected menu as command argument. You can cast this argument to IMenuItem and decide which menu is selected. MenuCommand will be fired after the MenuItemInvoked event.</p>

</body>
</html>
